package com.nextbusmn.client;

import java.io.IOException;

import com.google.appengine.tools.remoteapi.RemoteApiInstaller;
import com.google.appengine.tools.remoteapi.RemoteApiOptions;
import javax.jdo.PersistenceManager;
import javax.servlet.ServletException;

import com.nextbusmn.server.JDOWrappers.JDOWrapper;
import com.nextbusmn.server.LoadScheduleServlet;
import com.google.apphosting.api.ApiProxy.Delegate;

/**
 *  Remote API Client to bulk upload data to App Engine Server
 *  @author Trent Olson
 */
public class RemoteApiClient {
	
  // add your Google Credentials below
	private static String gmailAddress = "xxxxxxx@gmail.com";
	private static String gmailPassword = "PUT_YOUR_GMAIL_PWD_HERE";
	
	public static void main(String[] args) {
		try {
			
      // sets options to point to our app engine instance
			RemoteApiOptions options = new RemoteApiOptions()
				.server("ics499-nextbus.appspot.com", 443) 
				.remoteApiPath("/remote-api")
				.credentials(gmailAddress, gmailPassword);
			RemoteApiInstaller installer = new RemoteApiInstaller();
			installer.install(options);
			
      // create an instance of the load schedule servlet locally
      // and call its loadSchedule method
			new LoadScheduleServlet().loadSchedule();
			
		} catch (IOException e) {
			System.out.println("Something went horribly wrong");
			e.printStackTrace();
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
